#include <REGX52.H>


sbit led1 = P3 ^ 7;
sbit led2 = P3 ^ 6;

sbit key1 = P2 ^ 1;
sbit key2 = P2 ^ 0;

sbit zhengdong = P3 ^ 3;

void Delay(unsigned int xms)     //@11.0592MHz
{
    unsigned char i, j;
    while (xms)
    {
        i = 2;
        j = 199;
        do
        {
            while (--j);
        }
        while (--i);

        xms--;
    }
}


void main()
{
    led1 = 1;
    led2 = 1;
    while (1)
    {
        
       if(zhengdong == 0){
            Delay(20);
            led1 = 0;
        }
        
        if(key1 == 0){
            Delay(20);
            while(key1 == 0);
            Delay(20);
          
            led1 = ~led1;

        }
        
        if(key2 == 0){
            Delay(20);
            while(key2 == 0);
            Delay(20);
            
            led2 = ~led2;

        }
    }
}
